package com.etcn.modules.statical.statistics.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.etcn.common.annotation.Manage;
import com.etcn.common.controller.BaseController;
import com.etcn.modules.statical.statistics.pojo.Statistics;
import com.etcn.modules.statical.statistics.service.IStatisticsService;

/**
 * 统计
 * @author guozc
 * @date: 2018-01-12 10:38:06
 */
@Controller
@RequestMapping("/v1/statistics")
public class StatisticsController extends BaseController {
	
	@Autowired
	private IStatisticsService statisticsService;

    @Manage
    @RequestMapping(value = "exponent/{type}/{code}", method = RequestMethod.GET)
    public @ResponseBody Object exponents(Statistics entity) throws Exception{
    	return statisticsService.getExponent(entity);
    }
    
    @Manage
    @RequestMapping(value = "rate/{type}/{code}", method = RequestMethod.GET)
    public @ResponseBody Object rate(Statistics statistics) throws Exception{
    	return statisticsService.getRate(statistics);
    }
    
    @Manage
    @RequestMapping(value = "detail/{type}/{code}", method = RequestMethod.GET)
    public @ResponseBody Object detail(Statistics statistics) throws Exception{
    	return statisticsService.getDetail(statistics);
    }
    
    /**
     * 查询归类/税则详情
     * @param hscode 海关编码
     * @return
     * @throws Exception
     */
    @Manage
    @RequestMapping(value = "classifications/detail/{hscode}", method = RequestMethod.GET)
    public @ResponseBody Object getClassificationsDetail(@PathVariable("hscode") String hscode) throws Exception{
    	return statisticsService.getClassificationsDetail(hscode);
    }
    
    /**
     * 查询归类/税则详情
     * @param hscode 海关编码
     * @return
     * @throws Exception
     */
    @Manage
    @RequestMapping(value = "classifications/detail/tax/{hscode}", method = RequestMethod.GET)
    public @ResponseBody Object getClassificationsTax(@PathVariable("hscode") String hscode, String countryCode) throws Exception{
    	return statisticsService.getClassificationsTax(hscode, countryCode);
    }
}